package Threads.threads3.threads3.threads3_src.ex1;

/**
 * @author Luis C. Marques
 */

public class Conta extends Object {

    private int saldo;

    /* Experimentar este codigo com e sem o synchronized */
    /*synchronized*/ void movimento(int valor, String nome){        
        setSaldo(getSaldo() + valor);
      }

    public void setSaldo(int valor){
	try { Thread.sleep(1); } catch (InterruptedException ex){} 
        saldo = valor;
    }

    public int getSaldo(){
        try { Thread.sleep(1); } catch (InterruptedException ex){}
        return saldo;
    }
}

